<html>
<head><meta charset="utf-8"><title>MIR inliner can finally complete a bootstrap · t-compiler/wg-mir-opt · Zulip Chat Archive</title></head>
<h2>Stream: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/index.html">t-compiler/wg-mir-opt</a></h2>
<h3>Topic: <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html">MIR inliner can finally complete a bootstrap</a></h3>

<hr>

<base href="https://rust-lang.zulipchat.com">

<head><link href="https://rust-lang.github.io/zulip_archive/style.css" rel="stylesheet"></head>

<a name="185595410"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185595410" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185595410">(Jan 14 2020 at 13:31)</a>:</h4>
<p>With a <a href="https://github.com/rust-lang/rust/pull/68213/commits/a3db6204e6d3d1d7fc994de4fb76a7f1d23a7e4f" target="_blank" title="https://github.com/rust-lang/rust/pull/68213/commits/a3db6204e6d3d1d7fc994de4fb76a7f1d23a7e4f">simple patch</a> to turn the MIR inliner on, <code>./x.py build</code> now completes successfully! There's 4 failing UI tests which seem to be more or less expected but the rest of the tests seem to pass.</p>



<a name="185595543"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185595543" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185595543">(Jan 14 2020 at 13:33)</a>:</h4>
<p>Failures:</p>
<div class="codehilite"><pre><span></span>failures:
    [ui] ui/async-await/async-closure.rs
    [ui] ui/backtrace-debuginfo.rs
    [ui] ui/issues/issue-22638.rs
    [ui] ui/type_length_limit.rs

test result: FAILED. 1 passed; 4 failed; 9515 ignored; 0 measured; 0 filtered out
</pre></div>



<a name="185595564"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185595564" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185595564">(Jan 14 2020 at 13:33)</a>:</h4>
<p>I'm doing a perf run in <a href="https://github.com/rust-lang/rust/issues/68213" target="_blank" title="https://github.com/rust-lang/rust/issues/68213">#68213</a> to see where we stand. I suspect we will need to make some tweaks to the cost algorithm to see wins.</p>



<a name="185595788"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185595788" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185595788">(Jan 14 2020 at 13:36)</a>:</h4>
<p>We should also do a crater run with the optimization enabled</p>



<a name="185685885"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185685885" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185685885">(Jan 15 2020 at 10:34)</a>:</h4>
<p>Update: The perf run completed and most cases show a 2-5% improvement. However, there are some major regressions, most notably <code>deeply-nested-opt</code> which regressed 901,432.7%! I posted an analysis on the PR which I'll copy here:</p>
<blockquote>
<p>Looking at the (major) regressions, I'm seeing the following patterns:</p>
<ul>
<li>
<p>LLVM taking much more time</p>
<ul>
<li>This affects the deep-vector-opt, keccak-debug, regex-debug, encoding-debug, and most significantly deeply-nested-opt.</li>
<li><a href="https://github.com/rust-lang/rust/issues/68105" target="_blank" title="https://github.com/rust-lang/rust/issues/68105">#68105</a> seems related</li>
</ul>
</li>
<li>
<p>normalize_ty_after_erasing_regions being called more times:</p>
<ul>
<li>This affects the await-call-tree-check, await-call-tree-debug, and await-call-tree-opt tests.</li>
</ul>
</li>
</ul>
</blockquote>



<a name="185688917"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185688917" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185688917">(Jan 15 2020 at 11:21)</a>:</h4>
<p>One way to figure out what is causing these to regress may be to add more fine grained profiling for <code>self-profile</code> to pick up. E.g. what I did for const eval was to have the main query also create a profile section that had the name of the constant being evaluated in it. Most of the time these will just disappear in the noise and never show up, but if one of them dominates, that shows up</p>



<a name="185689035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689035">(Jan 15 2020 at 11:23)</a>:</h4>
<p>so for the <code>normalize_ty_after_erasing_regions</code> you could add a profile call <code>let _scope = tcx.prof.generic_activity(&amp;format!("inlining {}", instance));</code> before <a href="https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/inline.rs#L125-L133" target="_blank" title="https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/inline.rs#L125-L133">https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/inline.rs#L125-L133</a> and thus see inlining which functions takes time</p>



<a name="185689093"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689093" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689093">(Jan 15 2020 at 11:24)</a>:</h4>
<p>I mean technically this may be worthy of a query, because if a  function is inlined multiple times with the same generic parameters we may want to have a cached version of the monomorphic version available</p>



<a name="185689107"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689107" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689107">(Jan 15 2020 at 11:25)</a>:</h4>
<p>That's a good idea! mw actually landed support recently for recording query keys for every event so we might already have all the data we need</p>



<a name="185689111"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689111" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689111">(Jan 15 2020 at 11:25)</a>:</h4>
<p>oh heh</p>



<a name="185689113"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689113" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689113">(Jan 15 2020 at 11:25)</a>:</h4>
<p>wonderful</p>



<a name="185689115"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689115" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689115">(Jan 15 2020 at 11:25)</a>:</h4>
<p>That's obviously a better way than my hacky format stuff</p>



<a name="185689178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689178">(Jan 15 2020 at 11:26)</a>:</h4>
<p>And we just got the tooling support to read them in measureme this morning <a href="https://github.com/rust-lang/measureme/pull/108" target="_blank" title="https://github.com/rust-lang/measureme/pull/108">https://github.com/rust-lang/measureme/pull/108</a></p>



<a name="185689220"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689220" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689220">(Jan 15 2020 at 11:27)</a>:</h4>
<p>For the LLVM issue, I tried enabling <code>-Z print-llvm-passes</code> and I saw this:</p>
<div class="codehilite"><pre><span></span>Target Library Information
  FunctionPass Manager
    Dominator Tree Construction
    Natural Loop Information
    Branch Probability Analysis
    Block Frequency Analysis
</pre></div>


<p>and then a very long hang. So I attached gdb and got this backtrace:</p>
<div class="codehilite"><pre><span></span>#0  0x00007f98dd394337 in llvm::DenseMapBase&lt;llvm::DenseMap&lt;llvm::BasicBlock*, std::unique_ptr&lt;llvm::DomTreeNodeBase&lt;llvm::BasicBlock&gt;, std::default_delete&lt;llvm::DomTreeNodeBase&lt;llvm::BasicBlock&gt; &gt; &gt;, llvm::DenseMapInfo&lt;llvm::BasicBlock*&gt;, llvm::detail::DenseMapPair&lt;llvm::BasicBlock*, std::unique_ptr&lt;llvm::DomTreeNodeBase&lt;llvm::BasicBlock&gt;, std::default_delete&lt;llvm::DomTreeNodeBase&lt;llvm::BasicBlock&gt; &gt; &gt; &gt; &gt;, llvm::BasicBlock*, std::unique_ptr&lt;llvm::DomTreeNodeBase&lt;llvm::BasicBlock&gt;, std::default_delete&lt;llvm::DomTreeNodeBase&lt;llvm::BasicBlock&gt; &gt; &gt;, llvm::DenseMapInfo&lt;llvm::BasicBlock*&gt;, llvm::detail::DenseMapPair&lt;llvm::BasicBlock*, std::unique_ptr&lt;llvm::DomTreeNodeBase&lt;llvm::BasicBlock&gt;, std::default_delete&lt;llvm::DomTreeNodeBase&lt;llvm::BasicBlock&gt; &gt; &gt; &gt; &gt;::find(llvm::BasicBlock const*) const () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#1  0x00007f98de816c22 in llvm::DominatorTreeBase&lt;llvm::BasicBlock, false&gt;::getNode(llvm::BasicBlock const*) const ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#2  0x00007f98de817036 in llvm::DominatorTreeBase&lt;llvm::BasicBlock, false&gt;::dominates(llvm::BasicBlock const*, llvm::BasicBlock const*) const ()
   from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#3  0x00007f98ddf0c500 in llvm::GVN::findLeader(llvm::BasicBlock const*, unsigned int) () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#4  0x00007f98ddf18a93 in llvm::GVN::processInstruction(llvm::Instruction*) () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#5  0x00007f98ddf18cb9 in llvm::GVN::processBlock(llvm::BasicBlock*) () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#6  0x00007f98ddf18f90 in llvm::GVN::iterateOnFunction(llvm::Function&amp;) () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#7  0x00007f98ddf19176 in llvm::GVN::runImpl(llvm::Function&amp;, llvm::AssumptionCache&amp;, llvm::DominatorTree&amp;, llvm::TargetLibraryInfo const&amp;, llvm::AAResults&amp;, llvm::MemoryDependenceResults*, llvm::LoopInfo*, llvm::OptimizationRemarkEmitter*) () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#8  0x00007f98ddf19ee1 in llvm::gvn::GVNLegacyPass::runOnFunction(llvm::Function&amp;) () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#9  0x00007f98de867518 in llvm::FPPassManager::runOnFunction(llvm::Function&amp;) () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#10 0x00007f98de40e93b in (anonymous namespace)::CGPassManager::runOnModule(llvm::Module&amp;) () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#11 0x00007f98de8668c8 in llvm::legacy::PassManagerImpl::run(llvm::Module&amp;) () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
--Type &lt;RET&gt; for more, q to quit, c to continue without paging--
#12 0x00007f98de7e2679 in LLVMRunPassManager () from /home/wesley/.rustup/toolchains/stage1/lib/librustc_driver-9d36f6e088352849.so
#13 0x00007f98dc80bab8 in rustc_codegen_llvm::back::write::optimize (cgcx=0x7f98d8238150, diag_handler=&lt;optimized out&gt;, module=&lt;optimized out&gt;, config=&lt;optimized out&gt;)
    at src/librustc_codegen_llvm/back/write.rs:444
#14 &lt;rustc_codegen_llvm::LlvmCodegenBackend as rustc_codegen_ssa::traits::write::WriteBackendMethods&gt;::optimize (cgcx=&lt;optimized out&gt;, diag_handler=0x7f98d8237e50, module=&lt;optimized out&gt;,
    config=0x7f98d4510f70) at src/librustc_codegen_llvm/lib.rs:160
#15 0x00007f98dc6deff8 in rustc_codegen_ssa::back::write::execute_optimize_work_item (cgcx=0x7f98d8238150, module_config=0x7f98d4510f70, module=...)
    at /home/wesley/code/rust/rust/src/librustc_codegen_ssa/back/write.rs:740
#16 rustc_codegen_ssa::back::write::execute_work_item (cgcx=0x7f98d8238150, work_item=...) at /home/wesley/code/rust/rust/src/librustc_codegen_ssa/back/write.rs:717
</pre></div>



<a name="185689291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689291">(Jan 15 2020 at 11:28)</a>:</h4>
<p>I thought originally this might have something to do with how many blocks were in the function being optimized but after running the inliner, we actually have fewer blocks than when we started.</p>



<a name="185689312"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689312" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689312">(Jan 15 2020 at 11:29)</a>:</h4>
<p>GVN looks at locals I believe and we do create a lot more locals for the <code>deeply-nested</code> test after inlining.</p>



<a name="185689385"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689385" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689385">(Jan 15 2020 at 11:30)</a>:</h4>
<p>so... this is some exponential algorithm on the number of locals?</p>



<a name="185689393"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689393" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689393">(Jan 15 2020 at 11:30)</a>:</h4>
<p>I guess?</p>



<a name="185689400"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689400" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689400">(Jan 15 2020 at 11:30)</a>:</h4>
<p>I know nothing of LLVM internals</p>



<a name="185689401"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689401" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689401">(Jan 15 2020 at 11:30)</a>:</h4>
<p>"GVNLegacyPass" sounds dubious</p>



<a name="185689405"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689405" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689405">(Jan 15 2020 at 11:30)</a>:</h4>
<p>Yeah I thought so too</p>



<a name="185689411"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689411" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689411">(Jan 15 2020 at 11:31)</a>:</h4>
<p>But it looks like "New GVN" isn't ready yet</p>



<a name="185689423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689423">(Jan 15 2020 at 11:31)</a>:</h4>
<p>Hmm... the docs aren't helpful :D <a href="http://llvm.org/doxygen/classllvm_1_1gvn_1_1GVNLegacyPass.html" target="_blank" title="http://llvm.org/doxygen/classllvm_1_1gvn_1_1GVNLegacyPass.html">http://llvm.org/doxygen/classllvm_1_1gvn_1_1GVNLegacyPass.html</a></p>



<a name="185689435"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689435" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689435">(Jan 15 2020 at 11:31)</a>:</h4>
<p>Yeah lol</p>



<a name="185689477"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689477" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689477">(Jan 15 2020 at 11:32)</a>:</h4>
<p>Here's the tracking bug for New GVN <a href="https://bugs.llvm.org/show_bug.cgi?id=30995" target="_blank" title="https://bugs.llvm.org/show_bug.cgi?id=30995">https://bugs.llvm.org/show_bug.cgi?id=30995</a></p>



<a name="185689493"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689493" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689493">(Jan 15 2020 at 11:32)</a>:</h4>
<p>// This pass performs global value numbering to eliminate fully redundant<br>
 // instructions.  It also performs simple dead load elimination.<br>
 //<br>
 // Note that this pass does the value numbering itself; it does not use the<br>
 // ValueNumbering analysis passes.</p>



<a name="185689667"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689667" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689667">(Jan 15 2020 at 11:36)</a>:</h4>
<p>Something kind of interesting about the <code>deeply-nested</code> test case: before inlining, we have 34 basic blocks and 35 locals, after inlining we have only 16 basic blocks but we now have 53 locals.</p>



<a name="185689685"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689685" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689685">(Jan 15 2020 at 11:37)</a>:</h4>
<p>that doesn't sound like something that should end up exploding llvm</p>



<a name="185689697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689697">(Jan 15 2020 at 11:37)</a>:</h4>
<p>do you have a mir dump available that I could look at?</p>



<a name="185689703"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689703" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689703">(Jan 15 2020 at 11:37)</a>:</h4>
<p>Sure</p>



<a name="185689775"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689775" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689775">(Jan 15 2020 at 11:38)</a>:</h4>
<p><a href="https://gist.github.com/wesleywiser/1a01122c920a8771a64a59847cfdf272" target="_blank" title="https://gist.github.com/wesleywiser/1a01122c920a8771a64a59847cfdf272">https://gist.github.com/wesleywiser/1a01122c920a8771a64a59847cfdf272</a></p>



<a name="185689797"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185689797" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185689797">(Jan 15 2020 at 11:39)</a>:</h4>
<p>There's also the weird extra <code>scope { }</code>s that the inliner produces</p>



<a name="185690047"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690047" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690047">(Jan 15 2020 at 11:44)</a>:</h4>
<p>We could just start optimizing out random things until llvm morale improves</p>



<a name="185690150"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690150" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690150">(Jan 15 2020 at 11:46)</a>:</h4>
<p>e.g. assignments of zst locals are pretty much useless. We could just eliminate them, even generic uses of <code>PhantomData</code> could just be killed</p>



<a name="185690252"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690252" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690252">(Jan 15 2020 at 11:48)</a>:</h4>
<p>Hmm</p>



<a name="185690264"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690264" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690264">(Jan 15 2020 at 11:48)</a>:</h4>
<p>Let me dump the rest of the method after the other optimization passes. I would think ConstProp and SimplifyLocals would already do that.</p>



<a name="185690265"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690265" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690265">(Jan 15 2020 at 11:48)</a>:</h4>
<p>also... why did <code>Iterator::chain</code> not get inlined</p>



<a name="185690323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690323">(Jan 15 2020 at 11:50)</a>:</h4>
<p>I guess <code>Chain::new(self, other.into_iter())</code> is either too complex to inline or it bailed out due to other reasons</p>



<a name="185690358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690358">(Jan 15 2020 at 11:50)</a>:</h4>
<blockquote>
<p>[DEBUG rustc_mir::transform::inline] NOT inlining CallSite { callee: DefId(2:4728 ~ core[e46f]::iter[0]::traits[0]::iterator[0]::Iterator[0]::chain[0]), substs: [std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Chain&lt;std::iter::Empty&lt;()&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;&gt;, std::iter::Empty&lt;()&gt;], bb: bb32, location: SourceInfo { span: test.rs:4:14: 20:24, scope: scope[0] } } [cost=106 &gt; threshold=100]</p>
</blockquote>



<a name="185690697"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690697" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690697">(Jan 15 2020 at 11:57)</a>:</h4>
<p>hmm...</p>



<a name="185690716"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690716" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690716">(Jan 15 2020 at 11:57)</a>:</h4>
<p>Oh const prop doesn't handle it because it's an assignment on a projection of a local <a href="https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/const_prop.rs#L828" target="_blank" title="https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/const_prop.rs#L828">https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/const_prop.rs#L828</a></p>



<a name="185690773"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690773" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690773">(Jan 15 2020 at 11:58)</a>:</h4>
<p>oh heh...</p>



<a name="185690816"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690816" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690816">(Jan 15 2020 at 11:59)</a>:</h4>
<p>so... the inlining cost is computed on the polymorphic MIR of a function, and all locals with unknown type size (so all generic locals) have cost 10</p>



<a name="185690821"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690821" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690821">(Jan 15 2020 at 11:59)</a>:</h4>
<p>also function calls have cost 25</p>



<a name="185690830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690830">(Jan 15 2020 at 11:59)</a>:</h4>
<p>so the two function calls + a few locals + a few instructions would quickly build up to 106</p>



<a name="185690896"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690896" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690896">(Jan 15 2020 at 12:00)</a>:</h4>
<p>imo the cost model was just a place holder since the pass was never really enabled</p>



<a name="185690904"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690904" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690904">(Jan 15 2020 at 12:00)</a>:</h4>
<p>but I'm not the original author so I can't say for sure</p>



<a name="185690921"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690921" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690921">(Jan 15 2020 at 12:00)</a>:</h4>
<p>yea</p>



<a name="185690925"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185690925" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185690925">(Jan 15 2020 at 12:00)</a>:</h4>
<p>I don't think there's ever been any tweaks made to it</p>



<a name="185691546"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185691546" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185691546">(Jan 15 2020 at 12:12)</a>:</h4>
<p>Well, the costs themselves are probably taken from llvm: <a href="https://llvm.org/doxygen/namespacellvm_1_1InlineConstants.html" target="_blank" title="https://llvm.org/doxygen/namespacellvm_1_1InlineConstants.html">https://llvm.org/doxygen/namespacellvm_1_1InlineConstants.html</a></p>



<a name="185691675"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185691675" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185691675">(Jan 15 2020 at 12:15)</a>:</h4>
<p>but llvm has no hard threshold</p>



<a name="185691774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185691774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185691774">(Jan 15 2020 at 12:17)</a>:</h4>
<p>llvm has fun things like <a href="https://github.com/llvm/llvm-project/blob/064087581ab98cca7254b4d0f12ecbed13da2692/llvm/lib/Analysis/InlineCost.cpp#L1250" target="_blank" title="https://github.com/llvm/llvm-project/blob/064087581ab98cca7254b4d0f12ecbed13da2692/llvm/lib/Analysis/InlineCost.cpp#L1250">https://github.com/llvm/llvm-project/blob/064087581ab98cca7254b4d0f12ecbed13da2692/llvm/lib/Analysis/InlineCost.cpp#L1250</a> though</p>



<a name="185691887"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185691887" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185691887">(Jan 15 2020 at 12:19)</a>:</h4>
<p>That seems likely</p>



<a name="185691968"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185691968" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185691968">(Jan 15 2020 at 12:20)</a>:</h4>
<p>ah</p>



<a name="185691970"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185691970" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185691970">(Jan 15 2020 at 12:20)</a>:</h4>
<p><a href="https://github.com/llvm/llvm-project/blob/064087581ab98cca7254b4d0f12ecbed13da2692/llvm/lib/Analysis/InlineCost.cpp#L49" target="_blank" title="https://github.com/llvm/llvm-project/blob/064087581ab98cca7254b4d0f12ecbed13da2692/llvm/lib/Analysis/InlineCost.cpp#L49">https://github.com/llvm/llvm-project/blob/064087581ab98cca7254b4d0f12ecbed13da2692/llvm/lib/Analysis/InlineCost.cpp#L49</a></p>



<a name="185691979"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185691979" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185691979">(Jan 15 2020 at 12:20)</a>:</h4>
<p>so the default threshold is 225 in llvm</p>



<a name="185692028"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692028" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692028">(Jan 15 2020 at 12:21)</a>:</h4>
<p>and much higher values for hot calls</p>



<a name="185692035"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692035" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692035">(Jan 15 2020 at 12:21)</a>:</h4>
<p>and much lower values for cold calls</p>



<a name="185692038"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692038" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692038">(Jan 15 2020 at 12:21)</a>:</h4>
<p>so uh :D</p>



<a name="185692110"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692110" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692110">(Jan 15 2020 at 12:22)</a>:</h4>
<p>We should play with the inlining costs?</p>



<a name="185692117"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692117" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692117">(Jan 15 2020 at 12:22)</a>:</h4>
<p>we may be confusing llvm by having a higher threshold for cold calls than they do and a lower one for hot calls</p>



<a name="185692128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692128">(Jan 15 2020 at 12:22)</a>:</h4>
<p>Hm</p>



<a name="185692138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692138">(Jan 15 2020 at 12:22)</a>:</h4>
<p>well, idk if we can solve this without actually putting a lot of mindpower into it</p>



<a name="185692163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692163">(Jan 15 2020 at 12:23)</a>:</h4>
<p>What do you mean by confusing llvm?</p>



<a name="185692178"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692178" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692178">(Jan 15 2020 at 12:23)</a>:</h4>
<p>We don't pass any of this data to llvm from the inliner</p>



<a name="185692193"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692193" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692193">(Jan 15 2020 at 12:23)</a>:</h4>
<p>right, what I mean is we now inline cold calls that llvm didn't see inlined before</p>



<a name="185692196"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692196" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692196">(Jan 15 2020 at 12:23)</a>:</h4>
<p>So the only thing that should be happening is that we don't inline enough</p>



<a name="185692206"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692206" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692206">(Jan 15 2020 at 12:24)</a>:</h4>
<p>ah</p>



<a name="185692269"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692269" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692269">(Jan 15 2020 at 12:24)</a>:</h4>
<p>well we do <a href="https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/inline.rs#L257" target="_blank" title="https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/inline.rs#L257">https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/inline.rs#L257</a></p>



<a name="185692278"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692278" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692278">(Jan 15 2020 at 12:24)</a>:</h4>
<p>which is pretty close for the current threshold, so</p>



<a name="185692287"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692287" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692287">(Jan 15 2020 at 12:24)</a>:</h4>
<p>that's probably not the cause either</p>



<a name="185692291"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692291" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692291">(Jan 15 2020 at 12:24)</a>:</h4>
<p>idk, how to debug this</p>



<a name="185692306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692306">(Jan 15 2020 at 12:25)</a>:</h4>
<p>just fiddling with the inlining cost seems fragile</p>



<a name="185692330"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692330" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692330">(Jan 15 2020 at 12:25)</a>:</h4>
<p>Should we perhaps not inline <code>#[cold]</code> functions <em>at all</em>?</p>



<a name="185692350"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692350" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692350">(Jan 15 2020 at 12:25)</a>:</h4>
<p>if llvm does it, there's no reason for us not to do it</p>



<a name="185692488"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692488" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692488">(Jan 15 2020 at 12:27)</a>:</h4>
<p>oh</p>



<a name="185692498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692498">(Jan 15 2020 at 12:27)</a>:</h4>
<p>one thing that may be relevant</p>



<a name="185692558"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692558" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692558">(Jan 15 2020 at 12:28)</a>:</h4>
<p>can you check the llvm IR vs the llvm IR on nightly?</p>



<a name="185692568"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692568" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692568">(Jan 15 2020 at 12:28)</a>:</h4>
<p>maybe llvm now optimizes better</p>



<a name="185692581"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692581" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692581">(Jan 15 2020 at 12:28)</a>:</h4>
<p>After the LLVM optimizations run or before?</p>



<a name="185692604"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692604" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692604">(Jan 15 2020 at 12:28)</a>:</h4>
<p>after</p>



<a name="185692628"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692628" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692628">(Jan 15 2020 at 12:29)</a>:</h4>
<p>like I'm wondering if llvm optimizes away the entire test now</p>



<a name="185692719"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692719" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692719">(Jan 15 2020 at 12:30)</a>:</h4>
<p>if that entire functions ends up with a <code>Box::new(())</code> and nothing else, then I'd say the compile-time perf hit is kinda warranted</p>



<a name="185692846"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692846" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692846">(Jan 15 2020 at 12:32)</a>:</h4>
<p>So I have some random changes I'm playing with an <em>something</em> in them fixed it?</p>



<a name="185692854"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692854" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692854">(Jan 15 2020 at 12:32)</a>:</h4>
<p>Stashing for now and I'll track down what fixed it later</p>



<a name="185692877"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692877" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692877">(Jan 15 2020 at 12:33)</a>:</h4>
<p>wat</p>



<a name="185692890"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692890" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692890">(Jan 15 2020 at 12:33)</a>:</h4>
<p>It must have been this</p>
<div class="codehilite"><pre><span></span>diff --cc src/librustc_mir/transform/inline.rs
index f4e47b01cb3,f4e47b01cb3..2971347ec12
--- a/src/librustc_mir/transform/inline.rs
+++ b/src/librustc_mir/transform/inline.rs
@@@ -40,6 -40,6 +40,13 @@@ struct CallSite&lt;&#39;tcx&gt;
  impl&lt;&#39;tcx&gt; MirPass&lt;&#39;tcx&gt; for Inline {
      fn run_pass(&amp;self, tcx: TyCtxt&lt;&#39;tcx&gt;, source: MirSource&lt;&#39;tcx&gt;, body: &amp;mut BodyAndCache&lt;&#39;tcx&gt;) {
          if tcx.sess.opts.debugging_opts.mir_opt_level &gt;= 1 {
++            // Don&#39;t run the `Inliner` on bodies that are very large because LLVM does not handle
++            // them very well and increasing the number of blocks can drastically increase compile
++            // time.
++            if body.basic_blocks().len() &gt; 100 {
++                return;
++            }
++
              Inliner { tcx, source }.run_pass(body);
          }
      }
</pre></div>



<a name="185692962"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692962" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692962">(Jan 15 2020 at 12:34)</a>:</h4>
<p>huh, but I thought bodies with that many blocks would have been eliminated by <a href="https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/inline.rs#L335" target="_blank" title="https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/inline.rs#L335">https://github.com/rust-lang/rust/blob/632387f38dfbac0f2b8b8900c840fff7f1fb888e/src/librustc_mir/transform/inline.rs#L335</a> increasing the cost by 5 per block</p>



<a name="185692984"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692984" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692984">(Jan 15 2020 at 12:35)</a>:</h4>
<p>Yeah</p>



<a name="185692999"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185692999" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185692999">(Jan 15 2020 at 12:35)</a>:</h4>
<p>Eh, hang on I've undone my change and it's still compiling fast</p>



<a name="185693006"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185693006" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185693006">(Jan 15 2020 at 12:35)</a>:</h4>
<p>I'm doing something wrong</p>



<a name="185693067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185693067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185693067">(Jan 15 2020 at 12:36)</a>:</h4>
<p>already commited some changes?</p>



<a name="185693072"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185693072" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185693072">(Jan 15 2020 at 12:36)</a>:</h4>
<p>No, I'm on the same commit as my branch</p>



<a name="185693087"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185693087" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185693087">(Jan 15 2020 at 12:36)</a>:</h4>
<p>Does <code>build -i</code> not play nice with <code>git stash</code>?</p>



<a name="185693125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185693125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185693125">(Jan 15 2020 at 12:37)</a>:</h4>
<p>idk</p>



<a name="185693130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185693130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185693130">(Jan 15 2020 at 12:37)</a>:</h4>
<p>I have <code>incremental = true</code> in <code>config.toml</code></p>



<a name="185693170"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185693170" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185693170">(Jan 15 2020 at 12:38)</a>:</h4>
<p>I'm cleaning and rebuilding</p>



<a name="185696521"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185696521" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185696521">(Jan 15 2020 at 13:23)</a>:</h4>
<p>wut</p>



<a name="185696600"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185696600" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185696600">(Jan 15 2020 at 13:24)</a>:</h4>
<p>If I compile rustc with <code>./x.py build --stage 1 -i src/libstd</code> it is fast but if I compile without the <code>-i</code>, it is very slow.</p>



<a name="185706610"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185706610" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185706610">(Jan 15 2020 at 15:12)</a>:</h4>
<p>wtf</p>



<a name="185706677"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185706677" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185706677">(Jan 15 2020 at 15:13)</a>:</h4>
<p>oh</p>



<a name="185706741"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185706741" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> oli <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185706741">(Jan 15 2020 at 15:14)</a>:</h4>
<p>maybe it's because of the hack in inlining that prevents cycles</p>



<a name="185707345"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185707345" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185707345">(Jan 15 2020 at 15:20)</a>:</h4>
<p>Ah, that's a good hypothesis!</p>



<a name="185719721"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185719721" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185719721">(Jan 15 2020 at 17:11)</a>:</h4>
<p>I presume we don't handle debug information when inlining yet?</p>



<a name="185719774"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/185719774" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#185719774">(Jan 15 2020 at 17:11)</a>:</h4>
<p>No, that's what's breaking the <code>ui/backtrace-debuginfo.rs</code> test</p>



<a name="186953130"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/186953130" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#186953130">(Jan 30 2020 at 03:48)</a>:</h4>
<blockquote>
<p>can you check the llvm IR vs the llvm IR on nightly?</p>
</blockquote>
<p>The IR is exactly the same. </p>
<p>What's even more interesting is that if I mess with <code>-C codegen-units</code>, the compile time regression seems to go away. With codegen-units &lt; 3, the regression goes away. With codegen-units &gt;= 3, the regression appears.</p>
<p>Passing <code>-Z time-llvm-passes</code> shows this:</p>
<div class="codehilite"><pre><span></span>===-------------------------------------------------------------------------===
                      ... Pass execution timing report ...
===-------------------------------------------------------------------------===
  Total Execution Time: 16.3174 seconds (16.2279 wall clock)

   ---User Time---   --System Time--   --User+System--   ---Wall Time---  --- Name ---
  12.9047 ( 79.7%)   0.0039 (  3.2%)  12.9086 ( 79.1%)  12.9085 ( 79.5%)  Global Value Numbering #3
   1.1998 (  7.4%)   0.0000 (  0.0%)   1.1998 (  7.4%)   1.1998 (  7.4%)  Dead Store Elimination #3
   0.2420 (  1.5%)   0.0038 (  3.1%)   0.2458 (  1.5%)   0.2458 (  1.5%)  Combine redundant instructions #12
   0.2086 (  1.3%)   0.0148 ( 12.1%)   0.2234 (  1.4%)   0.2233 (  1.4%)  Function Integration/Inlining #3
   0.1406 (  0.9%)   0.0039 (  3.2%)   0.1445 (  0.9%)   0.1444 (  0.9%)  Memory SSA #3
....
</pre></div>



<a name="186989563"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/186989563" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#186989563">(Jan 30 2020 at 14:11)</a>:</h4>
<blockquote>
<p>The IR is exactly the same. </p>
</blockquote>
<p>To be clear: The IR for the test program is the same. I have no idea what the std library IR looks like.</p>



<a name="186989739"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/186989739" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#186989739">(Jan 30 2020 at 14:12)</a>:</h4>
<p>I'm trying to add support for enabling the LLVM <a href="https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/" target="_blank" title="https://aras-p.info/blog/2019/01/16/time-trace-timeline-flame-chart-profiler-for-Clang/">time-trace</a> feature which hopefully will give us more details. My C++ code is seg faulting though <span aria-label="laughter tears" class="emoji emoji-1f602" role="img" title="laughter tears">:laughter_tears:</span></p>



<a name="187016092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187016092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187016092">(Jan 30 2020 at 18:35)</a>:</h4>
<p>That <code>time-trace</code> looks very Clang-ish. Does it have much LLVM stuff?</p>



<a name="187016232"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187016232" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187016232">(Jan 30 2020 at 18:36)</a>:</h4>
<p>I think so? <a href="https://reviews.llvm.org/rL357340" target="_blank" title="https://reviews.llvm.org/rL357340">https://reviews.llvm.org/rL357340</a></p>



<a name="187016442"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187016442" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187016442">(Jan 30 2020 at 18:38)</a>:</h4>
<p>Aw, looks like it isn't a callback based interface. Having LLVM stuff in <code>-Zself-profile</code> would be neat.</p>



<a name="187017191"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187017191" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187017191">(Jan 30 2020 at 18:45)</a>:</h4>
<p>Yeah</p>



<a name="187017239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187017239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187017239">(Jan 30 2020 at 18:46)</a>:</h4>
<p>I'm not sure how useful it will be yet</p>



<a name="187017306"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187017306" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187017306">(Jan 30 2020 at 18:46)</a>:</h4>
<p>If it actually helps, we may want to see if we can change it to be callback based as you say.</p>



<a name="187017542"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187017542" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187017542">(Jan 30 2020 at 18:49)</a>:</h4>
<p>I guess you could also just parse the JSON it produces too and generate events from that? But having a <code>timeTraceProfilerInitializeWithCallbacks</code>function might be easier.</p>



<a name="187017850"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187017850" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187017850">(Jan 30 2020 at 18:52)</a>:</h4>
<p>Also looks like it's designed for a single thread only</p>



<a name="187017935"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187017935" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Zoxc <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187017935">(Jan 30 2020 at 18:53)</a>:</h4>
<p>So use <code>-j1</code> when testing it =P</p>



<a name="187018004"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187018004" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187018004">(Jan 30 2020 at 18:53)</a>:</h4>
<p>Ah</p>



<a name="187018026"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187018026" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187018026">(Jan 30 2020 at 18:54)</a>:</h4>
<p>Well that's why I'm getting a seg fault then</p>



<a name="187018128"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187018128" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187018128">(Jan 30 2020 at 18:54)</a>:</h4>
<p>and the issue doesn't repro under <code>-C codegen-units=1</code></p>



<a name="187036503"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187036503" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187036503">(Jan 30 2020 at 22:06)</a>:</h4>
<p>you can try to use the <a href="https://github.com/rust-lang/rust/pull/68406" target="_blank" title="https://github.com/rust-lang/rust/pull/68406">https://github.com/rust-lang/rust/pull/68406</a>  and then compile with <code>RUSTFLAGS="-Znew-llvm-pass-manager=y -Zself-profile -Zself-profile-events=llvm</code></p>



<a name="187036551"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187036551" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187036551">(Jan 30 2020 at 22:06)</a>:</h4>
<p>is needs the new passmanager in llvm but maybe can give some info anyway</p>



<a name="187036567"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187036567" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187036567">(Jan 30 2020 at 22:07)</a>:</h4>
<p>Oh, that's helpful</p>



<a name="187036569"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187036569" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187036569">(Jan 30 2020 at 22:07)</a>:</h4>
<p>Thanks!</p>



<a name="187036830"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187036830" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187036830">(Jan 30 2020 at 22:10)</a>:</h4>
<p>and if you do not want the new passmanager I have a supper old hack for it in <a href="https://github.com/andjo403/rust/tree/llvmProfiler" target="_blank" title="https://github.com/andjo403/rust/tree/llvmProfiler">https://github.com/andjo403/rust/tree/llvmProfiler</a> but that needs to recompile llvm as some changes was needed there</p>



<a name="187036990"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187036990" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187036990">(Jan 30 2020 at 22:12)</a>:</h4>
<p>I see there is a NewGVN pass in LLVM but I have no idea if it's any better than the current one</p>



<a name="187037903"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187037903" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187037903">(Jan 30 2020 at 22:24)</a>:</h4>
<p>about changing the codegen-units resulting in compile time regressions I found that the partitioning is not that good tried to fix part of it in <a href="https://github.com/rust-lang/rust/pull/65281" target="_blank" title="https://github.com/rust-lang/rust/pull/65281">https://github.com/rust-lang/rust/pull/65281</a> and some more info in <a href="https://github.com/rust-lang/rust/issues/64913" target="_blank" title="https://github.com/rust-lang/rust/issues/64913">https://github.com/rust-lang/rust/issues/64913</a></p>



<a name="187038701"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187038701" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187038701">(Jan 30 2020 at 22:34)</a>:</h4>
<p>Do you think there's blocking or something happening between cgu partitions?</p>



<a name="187039067"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187039067" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187039067">(Jan 30 2020 at 22:38)</a>:</h4>
<p>no I think that you only get unlucky with the partitioning. The smallest change in the estimated size can change alot of what is in the same cgu and due to that is it possible that one cgu gets alot larger and due to this affects the compile time</p>



<a name="187039239"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187039239" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187039239">(Jan 30 2020 at 22:41)</a>:</h4>
<p>had crates that got up to 20% faster to compile by only changing the partitioning algorithm</p>



<a name="187082538"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187082538" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187082538">(Jan 31 2020 at 13:21)</a>:</h4>
<p>It took longer than I hoped but I have a self contained repro:</p>
<div class="codehilite"><pre><span></span><span class="k">struct</span> <span class="nc">Empty</span><span class="p">(</span><span class="n">std</span>::<span class="n">marker</span>::<span class="n">PhantomData</span><span class="o">&lt;</span><span class="kt">u8</span><span class="o">&gt;</span><span class="p">);</span><span class="w"></span>

<span class="k">struct</span> <span class="nc">Chain</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">a</span>: <span class="nc">A</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">b</span>: <span class="nc">B</span><span class="p">,</span><span class="w"></span>
<span class="w">    </span><span class="n">which</span>: <span class="kt">bool</span><span class="p">,</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">main</span><span class="p">()</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="kd">let</span><span class="w"> </span><span class="n">_x</span>: <span class="nb">Box</span><span class="o">&lt;</span><span class="n">Hint</span><span class="o">&gt;</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="nb">Box</span>::<span class="n">new</span><span class="p">(</span><span class="n">empty</span><span class="p">()</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">())</span><span class="w"></span>
<span class="w">        </span><span class="p">.</span><span class="n">chain</span><span class="p">(</span><span class="n">empty</span><span class="p">()));</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">fn</span> <span class="nf">empty</span><span class="p">()</span><span class="w"> </span>-&gt; <span class="nc">Empty</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="n">Empty</span><span class="p">(</span><span class="n">std</span>::<span class="n">marker</span>::<span class="n">PhantomData</span><span class="p">)</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="w"> </span><span class="n">Hint</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Empty</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">hint</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">(</span><span class="kt">usize</span><span class="p">,</span><span class="w"> </span><span class="nb">Option</span><span class="o">&lt;</span><span class="kt">usize</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="p">(</span><span class="mi">0</span><span class="k">usize</span><span class="p">,</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="mi">0</span><span class="k">usize</span><span class="p">))</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">impl</span><span class="o">&lt;</span><span class="n">A</span>: <span class="nc">Hint</span><span class="p">,</span><span class="w"> </span><span class="n">B</span>: <span class="nc">Hint</span><span class="o">&gt;</span><span class="w"> </span><span class="n">Hint</span><span class="w"> </span><span class="k">for</span><span class="w"> </span><span class="n">Chain</span><span class="o">&lt;</span><span class="n">A</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="c1">//#[inline(always)]</span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">hint</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">(</span><span class="kt">usize</span><span class="p">,</span><span class="w"> </span><span class="nb">Option</span><span class="o">&lt;</span><span class="kt">usize</span><span class="o">&gt;</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="k">match</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">which</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">            </span><span class="kc">true</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="bp">self</span><span class="p">.</span><span class="n">which</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="kc">true</span><span class="p">;</span><span class="w"></span>
<span class="w">                </span><span class="bp">self</span><span class="p">.</span><span class="n">a</span><span class="p">.</span><span class="n">hint</span><span class="p">()</span><span class="w"></span>
<span class="w">            </span><span class="p">},</span><span class="w"></span>
<span class="w">            </span><span class="kc">false</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="p">(</span><span class="n">a_lower</span><span class="p">,</span><span class="w"> </span><span class="n">a_upper</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">a</span><span class="p">.</span><span class="n">hint</span><span class="p">();</span><span class="w"></span>
<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="p">(</span><span class="n">b_lower</span><span class="p">,</span><span class="w"> </span><span class="n">b_upper</span><span class="p">)</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="bp">self</span><span class="p">.</span><span class="n">b</span><span class="p">.</span><span class="n">hint</span><span class="p">();</span><span class="w"></span>

<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">lower</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="n">a_lower</span><span class="p">.</span><span class="n">saturating_add</span><span class="p">(</span><span class="n">b_lower</span><span class="p">);</span><span class="w"></span>

<span class="w">                </span><span class="kd">let</span><span class="w"> </span><span class="n">upper</span><span class="w"> </span><span class="o">=</span><span class="w"> </span><span class="k">match</span><span class="w"> </span><span class="p">(</span><span class="n">a_upper</span><span class="p">,</span><span class="w"> </span><span class="n">b_upper</span><span class="p">)</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">                    </span><span class="p">(</span><span class="nb">Some</span><span class="p">(</span><span class="n">x</span><span class="p">),</span><span class="w"> </span><span class="nb">Some</span><span class="p">(</span><span class="n">y</span><span class="p">))</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="n">x</span><span class="p">.</span><span class="n">checked_add</span><span class="p">(</span><span class="n">y</span><span class="p">),</span><span class="w"></span>
<span class="w">                    </span><span class="n">_</span><span class="w"> </span><span class="o">=&gt;</span><span class="w"> </span><span class="nb">None</span><span class="p">,</span><span class="w"></span>
<span class="w">                </span><span class="p">};</span><span class="w"></span>

<span class="w">                </span><span class="p">(</span><span class="n">lower</span><span class="p">,</span><span class="w"> </span><span class="n">upper</span><span class="p">)</span><span class="w"></span>
<span class="w">            </span><span class="p">}</span><span class="w"></span>
<span class="w">        </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>

<span class="k">trait</span><span class="w"> </span><span class="n">Hint</span><span class="w"> </span><span class="p">{</span><span class="w"></span>
<span class="w">    </span><span class="k">fn</span> <span class="nf">hint</span><span class="p">(</span><span class="o">&amp;</span><span class="k">mut</span><span class="w"> </span><span class="bp">self</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="p">(</span><span class="kt">usize</span><span class="p">,</span><span class="w"> </span><span class="nb">Option</span><span class="o">&lt;</span><span class="kt">usize</span><span class="o">&gt;</span><span class="p">);</span><span class="w"></span>

<span class="w">    </span><span class="k">fn</span> <span class="nf">chain</span><span class="o">&lt;</span><span class="n">B</span>: <span class="nc">Hint</span><span class="o">&gt;</span><span class="p">(</span><span class="bp">self</span><span class="p">,</span><span class="w"> </span><span class="n">other</span>: <span class="nc">B</span><span class="p">)</span><span class="w"> </span>-&gt; <span class="nc">Chain</span><span class="o">&lt;</span><span class="n">Self</span><span class="p">,</span><span class="w"> </span><span class="n">B</span><span class="o">&gt;</span><span class="w"> </span><span class="k">where</span><span class="w"> </span><span class="n">Self</span>: <span class="nb">Sized</span> <span class="p">{</span><span class="w"></span>
<span class="w">        </span><span class="n">Chain</span><span class="w"> </span><span class="p">{</span><span class="w"> </span><span class="n">a</span>: <span class="nc">self</span><span class="p">,</span><span class="w"> </span><span class="n">b</span>: <span class="nc">other</span><span class="p">,</span><span class="w"> </span><span class="n">which</span>: <span class="nc">false</span><span class="w"> </span><span class="p">}</span><span class="w"></span>
<span class="w">    </span><span class="p">}</span><span class="w"></span>
<span class="p">}</span><span class="w"></span>
</pre></div>



<a name="187082613"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187082613" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187082613">(Jan 31 2020 at 13:22)</a>:</h4>
<p>If you uncomment the <code>//#[inline(always)]</code> line, it compiles very slowly but if you comment it out, it compiles very quickly.</p>



<a name="187082635"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187082635" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187082635">(Jan 31 2020 at 13:22)</a>:</h4>
<p>The issue still repros if you use the <code>-Z no-parallel-llvm</code> flag so I was able to capture an LLVM time trace</p>



<a name="187083323"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187083323" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187083323">(Jan 31 2020 at 13:31)</a>:</h4>
<p><a href="https://www.speedscope.app/#profileURL=https%3A%2F%2Fgist.githubusercontent.com%2Fwesleywiser%2F3daf5710dfeaba66ae4f4d001cb36761%2Fraw%2Fd4d8141493f496e93574e7bd74335fdbd96f2b17%2Fllvm.json&amp;title=llvm" target="_blank" title="https://www.speedscope.app/#profileURL=https%3A%2F%2Fgist.githubusercontent.com%2Fwesleywiser%2F3daf5710dfeaba66ae4f4d001cb36761%2Fraw%2Fd4d8141493f496e93574e7bd74335fdbd96f2b17%2Fllvm.json&amp;title=llvm">https://www.speedscope.app/#profileURL=https%3A%2F%2Fgist.githubusercontent.com%2Fwesleywiser%2F3daf5710dfeaba66ae4f4d001cb36761%2Fraw%2Fd4d8141493f496e93574e7bd74335fdbd96f2b17%2Fllvm.json&amp;title=llvm</a></p>



<a name="187083383"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187083383" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187083383">(Jan 31 2020 at 13:32)</a>:</h4>
<p>Which shows that most of the time taken is in the <code>Chain::hint()</code> function running GVN.</p>



<a name="187092504"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187092504" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187092504">(Jan 31 2020 at 15:21)</a>:</h4>
<p>Have you compared the LLVM time trace with and without the PR so that the time is not moved from one cgu to another</p>



<a name="187093423"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187093423" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187093423">(Jan 31 2020 at 15:32)</a>:</h4>
<p>Do you mean PR 68406? I haven't had a chance yet. I'm hoping to get to it tonight.</p>



<a name="187094744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187094744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187094744">(Jan 31 2020 at 15:47)</a>:</h4>
<p>Hmm think that I was not mening PR test with the different codegen-units and check that the time is not moved from one cgu to another</p>



<a name="187095336"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187095336" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187095336">(Jan 31 2020 at 15:54)</a>:</h4>
<p>Oh gotcha. I've tried with cgu={1,2,3,4,5,8} and cgu={1,2} does not experience the issue. cgu &gt;= 3 does.</p>



<a name="187095358"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187095358" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187095358">(Jan 31 2020 at 15:54)</a>:</h4>
<p>Is there a way I can see what ended up in the cgu?</p>



<a name="187098550"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187098550" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> bjorn3 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187098550">(Jan 31 2020 at 16:29)</a>:</h4>
<p><span class="user-mention" data-user-id="125250">@Wesley Wiser</span> You could add println!() in the right place in the partitioning code, or you could use <code>-Cno-prepopulate-passes</code> to disable all llvm optimizations (including inlining), while keeping all rust optimizations enabled and <code>-Csave-temps</code> to keep all object files. You can then just look at the defined symbols in each object file.</p>



<a name="187098744"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187098744" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187098744">(Jan 31 2020 at 16:31)</a>:</h4>
<p>Brilliant, thanks!</p>



<a name="187173960"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187173960" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187173960">(Feb 01 2020 at 19:38)</a>:</h4>
<p><span class="user-mention" data-user-id="125799">@andjo403</span> It looks pretty much the same as what I was able to get out of the <code>time-trace</code> thing. Having it integrated with the self-profiler is awesome though! <a href="/user_uploads/4715/Ma3T38fWo5vZnKgvbw6i5ywv/Screenshot-from-2020-02-01-14-37-02.png" target="_blank" title="Screenshot-from-2020-02-01-14-37-02.png">Screenshot-from-2020-02-01-14-37-02.png</a></p>
<div class="message_inline_image"><a href="/user_uploads/4715/Ma3T38fWo5vZnKgvbw6i5ywv/Screenshot-from-2020-02-01-14-37-02.png" target="_blank" title="Screenshot-from-2020-02-01-14-37-02.png"><img src="/user_uploads/4715/Ma3T38fWo5vZnKgvbw6i5ywv/Screenshot-from-2020-02-01-14-37-02.png"></a></div>



<a name="187174063"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187174063" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187174063">(Feb 01 2020 at 19:40)</a>:</h4>
<p>that was the plan hope it can help some one and it also do not force you to use  <code>-Z no-parallel-llvm</code></p>



<a name="187174092"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187174092" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187174092">(Feb 01 2020 at 19:41)</a>:</h4>
<p>Yeah, it works great!</p>



<a name="187174099"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187174099" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187174099">(Feb 01 2020 at 19:41)</a>:</h4>
<p>Having de-mangled function names is also a plus</p>



<a name="187174163"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187174163" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187174163">(Feb 01 2020 at 19:43)</a>:</h4>
<p>yes it is nice</p>



<a name="187174236"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187174236" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187174236">(Feb 01 2020 at 19:44)</a>:</h4>
<p>was you able to see some difference in the logs when it was slow vs fast?</p>



<a name="187174351"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187174351" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187174351">(Feb 01 2020 at 19:48)</a>:</h4>
<p>No, it looks pretty much the same</p>



<a name="187174359"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187174359" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187174359">(Feb 01 2020 at 19:48)</a>:</h4>
<p>I'm playing the the <code>-Csave-temps</code> flag and the llvm dissembler to see if there's anything interesting in the cgu</p>



<a name="187174451"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187174451" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187174451">(Feb 01 2020 at 19:51)</a>:</h4>
<p>is it even more than one cgu created for that small program? can only see one in the speedscope log</p>



<a name="187174498"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187174498" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187174498">(Feb 01 2020 at 19:53)</a>:</h4>
<p>I believe so because I have stuff like <code>test2.test2.hash-cgu-0.*</code> and <code>test2.test2.hash-cgu-1.*</code> in the working directory</p>



<a name="187177380"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187177380" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187177380">(Feb 01 2020 at 21:29)</a>:</h4>
<p>So the only difference between the slow and fast test case I came up with at the IR level is that we pass the inline hint along to llvm</p>



<a name="187177389"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187177389" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187177389">(Feb 01 2020 at 21:29)</a>:</h4>
<p>However, when LLVM does the inlining, <code>size_hint()</code> balloons to have 327,680 locals</p>



<a name="187177487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187177487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187177487">(Feb 01 2020 at 21:32)</a>:</h4>
<p>Actually, I'm wrong. Those are only the trivially assigned variables in the first block.</p>



<a name="187177620"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187177620" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187177620">(Feb 01 2020 at 21:37)</a>:</h4>
<p>The function actually has 4,915,132 locals</p>



<a name="187177623"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187177623" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187177623">(Feb 01 2020 at 21:37)</a>:</h4>
<p>So it's not surprising GVN is falling over</p>



<a name="187178066"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178066" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178066">(Feb 01 2020 at 21:53)</a>:</h4>
<p>but how is codegen-units affecting is the inline hint is passed to llvm or not? or is that an other fault?</p>



<a name="187178116"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178116" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178116">(Feb 01 2020 at 21:54)</a>:</h4>
<p>if I want to reproduce this do I need some special PR or is master enough?</p>



<a name="187178125"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178125" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178125">(Feb 01 2020 at 21:55)</a>:</h4>
<p>I'm not sure yet</p>



<a name="187178137"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178137" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178137">(Feb 01 2020 at 21:55)</a>:</h4>
<p>Oh</p>



<a name="187178138"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178138" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178138">(Feb 01 2020 at 21:56)</a>:</h4>
<p>Ok</p>



<a name="187178177"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178177" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178177">(Feb 01 2020 at 21:56)</a>:</h4>
<p>When I rebased I lost my in progress changes the enabled the inliner</p>



<a name="187178187"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178187" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178187">(Feb 01 2020 at 21:56)</a>:</h4>
<p>Then <code>-C codegen-units</code> thing doesn't seem to make a difference once we've enabled the MIR inliner</p>



<a name="187178282"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178282" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178282">(Feb 01 2020 at 21:59)</a>:</h4>
<p>To recap:</p>
<ol>
<li>Cherry-pick this patch <a href="https://github.com/rust-lang/rust/pull/68213/commits/a3db6204e6d3d1d7fc994de4fb76a7f1d23a7e4f" target="_blank" title="https://github.com/rust-lang/rust/pull/68213/commits/a3db6204e6d3d1d7fc994de4fb76a7f1d23a7e4f">https://github.com/rust-lang/rust/pull/68213/commits/a3db6204e6d3d1d7fc994de4fb76a7f1d23a7e4f</a></li>
<li>Build with <code>./x.py build --stage 1 src/libstd</code> NOTE: if you build with <code>-i</code> you can't repro the issue</li>
<li>Try compiling the test example I posted above. You'll need to uncomment the <code>//#[inline(always)]</code> line with <code>rustc +stage1 -O repro.rs</code></li>
</ol>



<a name="187178361"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178361" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178361">(Feb 01 2020 at 22:01)</a>:</h4>
<p>ok will try to do that<br>
by the way have rebased the llvm profiling PR and fixed the comments</p>



<a name="187178408"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178408" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178408">(Feb 01 2020 at 22:02)</a>:</h4>
<p>Awesome! I took a look real quick and it looks good to me but since mw left the feedback, I'd like him to sign off.</p>



<a name="187178417"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178417" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178417">(Feb 01 2020 at 22:03)</a>:</h4>
<p>Can we rebase it without the changes from <a href="https://github.com/rust-lang/rust/issues/68170" target="_blank" title="https://github.com/rust-lang/rust/issues/68170">#68170</a> or is it dependent on those to compile?</p>



<a name="187178420"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178420" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178420">(Feb 01 2020 at 22:03)</a>:</h4>
<p>If not that's fine but we'll have to wait for that PR to merge before we can merge this one</p>



<a name="187178476"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178476" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178476">(Feb 01 2020 at 22:05)</a>:</h4>
<p>I wonder if this (compile-time regression) is maybe expected? We've tweaked the std library's <code>inline</code> annotations for years without MIR inlining. Now that we're enabling that, there might be functions that have become just small enough to trigger LLVM to inline that were before too large.</p>



<a name="187178482"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178482" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178482">(Feb 01 2020 at 22:05)</a>:</h4>
<p>yes it is still based on 68170 so that needs to be merged first</p>



<a name="187178487"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178487" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178487">(Feb 01 2020 at 22:05)</a>:</h4>
<p>Maybe we just need to undo a few key <code>#[inline]</code> hints?</p>



<a name="187178508"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178508" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178508">(Feb 01 2020 at 22:06)</a>:</h4>
<p>Ah, ok. That's fine :)</p>



<a name="187178531"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178531" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> Wesley Wiser <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178531">(Feb 01 2020 at 22:06)</a>:</h4>
<p>Gotta run <span aria-label="wave" class="emoji emoji-1f44b" role="img" title="wave">:wave:</span></p>



<a name="187178541"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187178541" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187178541">(Feb 01 2020 at 22:07)</a>:</h4>
<p>ok will maby look at it tomorrow kind of late here also</p>



<a name="187202384"></a>
<h4><a href="https://rust-lang.zulipchat.com#narrow/stream/189540-t-compiler/wg-mir-opt/topic/MIR%20inliner%20can%20finally%20complete%20a%20bootstrap/near/187202384" class="zl"><img src="https://rust-lang.github.io/zulip_archive/assets/img/zulip.svg" alt="view this post on Zulip" style="width:20px;height:20px;"></a> andjo403 <a href="https://rust-lang.github.io/zulip_archive/stream/189540-t-compiler/wg-mir-opt/topic/MIR.20inliner.20can.20finally.20complete.20a.20bootstrap.html#187202384">(Feb 02 2020 at 11:49)</a>:</h4>
<p>I get the same behavior with and without cherry pick and almost the same times with different codegen-units even tried with stage2 and the same thing</p>



<hr><p>Last updated: Aug 07 2021 at 22:04 UTC</p>
</html>